<include file="public@header"/>
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class=""><a href="{:url('goods/index',array('id'=>$id))}">甲供材</a></li>
        <li class="active"><a>详情</a></li>
    </ul>
    <form method="post" class="form-horizontal js-ajax-form margin-top-20" action="{:url('goods/doadd')}"
          enctype="multipart/form-data">


        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>使用班组 </label>
            <div class="col-md-6 col-sm-10">
                <select name="leaderId" class="form-control">
                    <option value="{$res['leaderId']}">{$res['leaderName']}</option>
                    <volist name="leader" id="v">
                        <option value="{$v.id}">{$v.name}</option>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>事件
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" name="desc" value="{$res['desc']}">
            </div>
        </div>



        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>签收人
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="sign" class="form-control">
                    <option value="{$res['sign']}">{$res['signName']}</option>
                    <volist name="rouster" id="vv">
                        <option value="{$vv.id}">{$vv.name}</option>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>仓库/现场
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="adress" class="form-control">
                    <?php if($res['adress'] == 1){?>
                    <option value="1">仓库</option>
                    <?php }else{?>
                    <option value="2">现场</option>
                    <?php }?>
                    <option value="1">仓库</option>
                    <option value="2">现场</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>班组接货
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="classes" class="form-control">
                    <option value="{$res['classes']}">{$res['className']}</option>
                    <volist name="leader" id="v">
                        <option value="{$v.id}">{$v.name}</option>
                    </volist>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>是否签字
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="isSign" class="form-control">
                    <?php if($res['isSign'] == 1){?>
                    <option value="1">是</option>
                    <?php }else{?>
                    <option value="2">否</option>
                    <?php }?>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                是否代买
            </label>
            <div class="col-md-6 col-sm-10">
                <select name="replace" class="form-control">
                    <?php if($res['replace'] == 1){?>
                    <option value="1">是</option>
                    <?php }else{?>
                    <option value="2">否</option>
                    <?php }?>
                    <option value="1">是</option>
                    <option value="2">否</option>
                </select>
            </div>
        </div>

        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                代买数量
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control" name="replceNums" value="{$res['replceNums']}">
            </div>
        </div>





        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                代买单位
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="text" class="form-control" value="项" readonly>
            </div>
        </div>





        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                代买单价
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="number" class="form-control" name="replcePrice" value="{$res['replcePrice']}">
            </div>
        </div>

        <!-- <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>单据图
            </label>
            <div class="col-md-6 col-sm-10">
                <input type="file" name="imgs[]" class="form-control" multiple>
            </div>
        </div>
        <div class="form-group">
            <label for="js-smtpsecure" class="col-sm-2 control-label">
                <span class="form-required">*</span>单据图
            </label>
            <div class="col-md-6 col-sm-10">
                <foreach name="res['imgs']" item="v">
                    <?php if($v != 'http://' . $_SERVER['SERVER_NAME']){?>
                    <img src="{$v}" alt="" width="250" height="150">
                    <?php } ?>
                </foreach>
            </div>
        </div> -->

        <div class="form-group">
                <label for="js-smtpsecure" class="col-sm-2 control-label">
                    单据图
                </label>
                <div class="col-md-6 col-sm-10">
                    <input type="file" name="imgs[]" class="form-control" id="contractUpload" multiple accept="image/*" />
                    <div id="contractPreviewContainer" class="image-preview-container" style="margin-top: 10px; display: flex; flex-wrap: wrap;"></div>
                </div>
            </div>

        <input type="hidden" name="eid" value="{$id}">


        <div class="form-group">
            <div class="col-sm-offset-2 col-sm-10">

                <a class="btn btn-default" href="javascript:history.back(-1);">{:lang('BACK')}</a>
            </div>
        </div>
    </form>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/js/image-uploader.js"></script>
<script>
       document.addEventListener('DOMContentLoaded', function() {
            // 初始化图片上传组件
            // 合同图片上传
            const contractUploader = new ImageUploader({
                inputId: 'contractUpload',
                previewContainerId: 'contractPreviewContainer',
                fieldName: 'contract',
                existingImages: [
                    <if condition="$res['imgs'] !== false">
                        <volist name="res['imgs']" id="v" key="k">
                            "{$v}",
                        </volist>
                    </if>
                ],
                useDataTransfer: true
            });
        });
</script>
</body>
</html>